<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base target="_self" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/web/style/layout.css" />
<script type="text/javascript"
	src="<%=path%>/jqGrid/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/jslib/jquery.validate.min.js"></script>
<script type='text/javascript'
	src="<%=request.getContextPath()%>/jslib/My97DatePicker/WdatePicker.js"
	defer="defer"></script>
<script type='text/javascript'
	src="<%=request.getContextPath()%>/jslib/jquery.form.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/jslib/additional-methods.js"></script>
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/demo.css">
<script type="text/javascript"
	src="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
<c:if test="${requestScope.message!=null}">
	<script type="text/javascript">
		alert('<c:out value="${requestScope.message}"></c:out>');
		window.close();
	</script>
</c:if>

<script type="text/javascript">
var api = frameElement.api, W = api.opener;
var stateValue="";
$().ready(function(){
        var actionUrl = '<%=request.getContextPath() %>/Shebeixianzhi!shebeixianzhiFlowFaqi.action?steptype='+$("#steptype0").val();		
		var options = {
	  	    url:actionUrl,
	  	     beforeSubmit: function() {
	   				return checking();
	    			},
	  	    dataType:'json',
	  	    success: function(data) {
	  	    //alert(data);
	  	      if(data.result=='success'){
				alert("提交成功");
			//	window.close();
				api.close();
				W.reload();
	  	      }
	  	    }};
	$('#saveBtn').click(function(){
		    	$('#pageFrom').ajaxSubmit(options);
 	            return false;
	 });
	$('#closeBtn').click(function(){
		api.close();
		//window.close();
	});
	
});

function checking(){
		var flag = true;
	var equName = $.trim($("#equName").val());
	var shenqinren = $.trim($("#shenqinren").val());
	var state = $.trim($("#state").val());
	var flowname = $.trim($("#flowname").val());
//	var lianxifangshi = $.trim($("#lianxifangshi").val());
	if(flowname ==null || flowname == "" ){
		alert("流程名称不能为空！");
		$("#flowname").focus();
		return false;
	}
	if(equName ==null || equName == "" ){
		alert("设备名称不能为空！");
		$("#equName").focus();
		return false;
	}
	if(shenqinren ==null || shenqinren == "" ){
		alert("申请人不能为空！");
		$("#shenqinren").focus();
		return false;
	}
	if(state ==null || state == "" ){
		alert("设备状态不能为空！");
		$("#state").focus();
		return false;
	}
	
//	if(lianxifangshi != null && lianxifangshi != ""){
//	}
	
}
var now = new Date();
var str=(now.getYear()+"-"+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"-"+(now.getDate()<10?"0":"")+now.getDate());

//选择设备
function selectshebei(){
	var datas = window.showModalDialog("<%=request.getContextPath() %>/view/shebeixianzhi_selectshebei.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=900px;dialogHeight=550px");
	if(typeof(datas) == 'undefined'){
	}else{
		var json1 = eval('(' + datas + ')');
		 document.getElementById("shebeiid").value = json1.ID;
		 document.getElementById("equName").value = json1.EQUNAME;
		 document.getElementById("equNo").value = json1.EQUNO;
		 document.getElementById("equGuge").value = json1.EQUGUGE;
		 document.getElementById("equOrgName").value = json1.EQUORGNAME;
		 document.getElementById("equHtNo").value = json1.ZICHANNO;
		 document.getElementById("equGjDate").value = json1.EQUGJDATE;
		 document.getElementById("tingyonDate").value = json1.TINGYONDATE;
		 document.getElementById("equYjsysj").value = json1.EQUYJSYSJ;
		 document.getElementById("sccj").value = json1.SCCJ;
		 document.getElementById("equYzhi").value = json1.EQUYZHI;
		 document.getElementById("equYzw").value = json1.EQUYZW;
		 document.getElementById("cfangdidian").value = json1.CFANGDIDIAN;
		 document.getElementById("state").value = json1.STATE;
		 document.getElementById("remark").value = json1.REMARK;
		 document.getElementById("xzqRemark").value = json1.XZQREMARK;
		 document.getElementById("xzmiaoshu").value = json1.XZMIAOSHU;
		 document.getElementById("shenqinren").value ='<%=session.getAttribute("username")%>';
		 
		 
	}
	
	function changevalue(){
	 	var fileValue = document.getElementById("file").value;
	 	var a=fileValue.lastIndexOf("\\");
	 	var filename = fileValue.substring(a+1);
		document.getElementById("fileName").value=filename;
	}

}

	
</script>
<style type="text/css">
body {
	background: #ffffff;
	background-image: url(images/);
}

html {
	overflow-x: hidden;
	overflow-y: hidden;
}

.formTableNew textarea {
	border: 1px solid #999;
	padding: 5px;
	width: 760px;
	-moz-border-radius: 3px;
	border-radius: 3px;
	margin-bottom: 5px;
	color: #666;
	background: url(../images/input_bg.gif) repeat-x top;
}
</style>
</head>

<body>
	<form id="pageFrom" action="" enctype="multipart/form-data"
		method="post">
		<input type="hidden" name="flowid" id="flowid" value="${flowid}">
		<input type="hidden" name="stateid" id="stateid" value="${stateid}">
		<input type="hidden" name="xianzhiid" id="xianzhiid" value="${requestScope.id}">
		${steptcontent} <input type="hidden" id="flag" name="flag" />
		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
			<tr>
			  <td align="right">流程名称:</td>
     		<td>
     		  	<input type="text" id="flowname" name="flowname" maxlength="50" value="设备闲置流程" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"/>
     			<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
     		</td>
  			</tr>
			<tr>
				<td align="right">设备名称：</td>
				<td align="left">
				<input type="text" id="equName" maxlength="50"	name="equName"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" readonly="readonly"	value="" /> 
					<input type="hidden"  id="shebeiid"	maxlength="50" name="shebeiid"   /> 
					<img
					src="<%=request.getContextPath()%>/images/xh.png" align="absmiddle">
					</img>
					<img src="<%=request.getContextPath()%>/web/images/form_icon_1.gif"
					style="cursor:hand; vertical-align: middle;"
					onclick="selectshebei()" />	
					</td>
				<td align="right">设备编号：</td>
				<td align="left"><input type="text" id="equNo" readonly maxlength="50"
					name="equNo"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
			</tr>
			<tr>
				<td align="right">规格型号：</td>
				<td align="left"><input type="text" id="equGuge" readonly maxlength="50"
					name="equGuge"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
					
				</td>
				<td align="right">部门：</td>
				<td align="left"><input type="text" id="equOrgName"
					maxlength="50" name="equOrgName" readonly
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" />
					
				</td>
			</tr>
			<tr>
				<td align="right">固定资产编码：</td>
				<td align="left"><input type="text" id="equHtNo" readonly maxlength="50"
					name="zichanNo"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
				
				</td>
				<td align="right">购进日期（转固日期）：</td>
				<td align="left"><input type="text" id="equGjDate" readonly
					name="equGjDate"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
				</td>
			</tr>
			<tr>
				<td align="right">停用日期：</td>
				<td align="left"><input type="text" id="tingyonDate" readonly
					maxlength="3" onChange="changePrice()"
					name="tingyonDate"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" />
					
				</td>
				<td align="right">已经使用时间（月）：</td>
				<td align="left"><input type="text" id="equYjsysj" readonly
					maxlength="50" name="equYjsysj"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
				</td>
			</tr>

			<tr>
				<td align="right">原值（元）：</td>
				<td align="left"><input type="text" id="equYzhi" maxlength="50"
					name="equYzhi"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" readonly
					value="" /> 
					
				</td>
				<td align="right">原值（万元）：</td>
				<td align="left"><input type="text" id="equYzw" maxlength="50" readonly
					name="equYzw"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
					
				</td>
			</tr>
			<tr>
				<td align="right">存放地点：</td>
				<td align="left"><input type="text" id="cfangdidian" readonly
					maxlength="50" name="cfangdidian"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
					
				</td>
				<td align="right">设备状态：</td>
  			  <td align="left">
  			  	<select id="state" class='fselect' name="state" class='easyui-validatebox' style="border: 1px solid #999;padding: 5px;width:250px;height:25px;" >
 			      <option value="状态1">状态1</option>
			 	  <option value="状态2">状态2</option>
 			    </select>
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
			</tr>
			<tr>
			<tr>
				<td align="right">闲置前使用情况描述 :</td>
				<td align="left"><input type="text" id="xzqRemark"
					maxlength="50" name="xzqRemark"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
					
				</td>
				<td align="right">闲置原因描述：</td>
				<td align="left"><input type="text" id="xzmiaoshu"
					maxlength="50" name="xzmiaoshu"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
					<img src="<%=request.getContextPath()%>/images/xh.png"
					align="absmiddle"></img>
				</td>
			</tr>
			<tr>
				<td align="right">闲置原因附件上传 :</td>
				<td align="left"> 
				<input type="hidden" id="XZFUJIAN" name="XZFUJIAN" />
				<jsp:include page="../fileupload/attachment.jsp?id=${requestScope.id }&column=XZFUJIAN&show=n" ></jsp:include>
				
				
				</td>
				<td align="right">申请人：</td>
				<td align="left"><input type="text" id="shenqinren"
					maxlength="50" name="shenqinren"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" />
					
				</td>
			</tr>
			<tr>
				<td align="right">申请日期 :</td>
				<td align="left"><input type="text" id="sqDate" maxlength="50"
					name="sqDate"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="<%=DateUtilsAll.dateToStringShort(new Date()) %>" /> 
					
				</td>
				<td align="right">生产厂家：</td>
				<td align="left"><input type="text" id="sccj" maxlength="11" readonly
					name="sccj" onChange="changePrice()"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="" /> 
					
				</td>
			</tr>
			<td align="right">设备功能及用途：</td>
			<td colspan="3">
				<div class="div">
					<textarea rows="5" cols="100" id="remark"
						name="remark" onkeydown="countlen1(this);"
						style="width: 720px;"></textarea>
				</div>
			</td>
			</tr>
		

		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
			<tr>
				<td align="center">
				<input id="saveBtn" type="button"value="提 交" class="form_bt_orange" />
				 <input type="button" id="closeBtn" value="取 消" class="form_bt_grey" /></td>
			</tr>
		</table>
		<!--表单结束-->
	</form>
</body>
</html>
